<!-- 服务规模明细编制 -->
<template>
  <div>
    <iframe :src="attachmentInfoUrl" scrolling="no" width="100%" :height="attachmentHeight" frameborder="0" />
  </div>

</template>
<script>

export default {
  name: 'ZrPmsServiceTabs',
  inject: ['prjDetail'],
  props: {
    isEdit: String,
    // 批量项目id
    selectList: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      attachmentHeight: 280
    }
  },
  computed: {
    newPrjDetail() {
      return this.prjDetail()
    },
    attachmentInfoUrl() {
      // 单站0,批量1
      const ifSingleProject = this.newPrjDetail.manageMode === '01' ? 0 : 1
      const subPrjId = this.selectList.map(item => item.prjId)
      const prjId = this.newPrjDetail.manageMode === '31' ? this.newPrjDetail.parentPrjId : this.newPrjDetail.prjId
      return `${process.env.VUE_APP_ZHONGRUAN_URL}pmsServiceTabs?prjId=${prjId}&subPrjId=${subPrjId}&ifSingleProject=${ifSingleProject}&type=${this.newPrjDetail.prjType}&ifEdit=${this.isEdit}`
    }
  },
  async created() {
    window.addEventListener('message', (event) => {
      const base_url = ''
      if (event.origin === base_url) {
        return
      }
      if (event.data.type === 'serviceHeight') {
        this.attachmentHeight = event.data.height
      }
    })
  }
}
</script>

<style scoped lang='scss'>
</style>
